package ru.magicreader.server.model;

import java.io.Serializable;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

/*
 * User settings.
 */
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Settings implements Serializable {
	private static final long serialVersionUID = 1L;

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key id;
	
	@Persistent
	private Integer nEntriesToShow = new Integer(5);

	public Key getId() {
		return id;
	}

	public void setNEntriesToShow(Integer nEntriesToShow) {
		this.nEntriesToShow = nEntriesToShow;
	}

	public Integer getNEntriesToShow() {
		return nEntriesToShow;
	}
	
	public String toJson() {
		return "{\n" +
			"\"nEntriesToShow\": " + nEntriesToShow + "\n" +
		"}\n";
	}
}
